package main.java.combination;

/**
 * 菜单组件 抽象根节点
 */
public abstract class MenuComponent {
    protected int level;
    protected String name;

    /**
     * 添加子菜单
     *
     * @param menuComponent
     */
    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * 移除子菜单
     * @param menuComponent
     */
    public void remove(MenuComponent menuComponent) {

        throw new UnsupportedOperationException();
    }

    /**
     * 获取指定的子菜单
     * @param index
     * @return
     */
    public MenuComponent getChild(int index){
        throw new UnsupportedOperationException();
    }

    /**
     * 获取菜单或菜单项的名称
     * @return
     */
    public String getName(){
        return name;
    }

    /**
     * 打印菜单名称（包含子菜单和子菜单项）
     */
    public abstract void print();
}